//
//  SCNMoreTableViewCell.swift
//  ShoucainuSwift
//
//  Created by 王家旭 on 2017/5/16.
//  Copyright © 2017年 Riluee. All rights reserved.
//

import UIKit

class SCNMoreTableViewCell: UITableViewCell {

    // icon
    lazy var iconImageView: UIImageView = {
        
        let imgView = UIImageView()
        imgView.image = UIImage(named: "icon_study_encourage")
        return imgView
    }()
    // 标题
    lazy var titleL: UILabel = {
        
        let lab = UILabel()
        lab.textColor = SCNConstants.colorWith255RGBA(136, g: 136, b: 136, a: 1)
        lab.font = UIFont.systemFont(ofSize: 17.0)
        return lab
    }()
    // 标签
    lazy var accessoryL: UILabel = {
        
        let lab = UILabel()
        lab.textColor = SCNConstants.colorWith255RGBA(66, g: 66, b: 66, a: 1)
        lab.font = UIFont.systemFont(ofSize: 15.0)
        lab.textAlignment = .right
        return lab
    }()
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.accessoryType = .disclosureIndicator
        
        contentView.addSubview(iconImageView)
        contentView.addSubview(titleL)
        contentView.addSubview(accessoryL)
        
        iconImageView.snp.makeConstraints { (make) in
            make.size.equalTo(CGSize(width: 28,height: 28))
            make.top.equalTo(11)
            make.leading.equalTo(10)
        }
        titleL.snp.makeConstraints { (make) in
            make.leading.equalTo(50)
            make.top.equalTo(10)
            make.size.equalTo(CGSize(width: 110,height: 30))
        }
        accessoryL.snp.makeConstraints { (make) in
            make.size.equalTo(CGSize(width: 150,height: 30))
            make.top.equalTo(10)
            make.trailing.equalTo(self).offset(-30)
        }
    }
    
    func configurationCell(_ obj: Dictionary<String, Any>,indexPath: IndexPath) {
        
        titleL.text = obj["title"] as? String
        iconImageView.image = UIImage(named: obj["img"]! as! String)
        if indexPath.section == 1 {
            if indexPath.row == 4 {
                accessoryL.text = "400-861-0186"
            }else if indexPath.row == 5 {
                accessoryL.text = SCNCommonParamter.version
                self.accessoryType = .none
                self.selectionStyle = .none
            }
        }
        

    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
